package com.xnxy.design.action;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

@Controller
public class htmlAction {

    String defaultloginRedirect="index";

    @RequestMapping("/login")
    private ModelAndView login(HttpServletRequest request, HttpServletResponse response) throws IOException {
        HttpSession session = (request).getSession();
        if ( session.getAttribute("user")!=null){
            response.sendRedirect("index");
            return null;
        }else {
            ModelAndView modelAndView = new ModelAndView("login");
            return modelAndView;
        }
    }

    @RequestMapping("/zhuce")
    public ModelAndView zhuce(){
        ModelAndView modelAndView = new ModelAndView("zhuce");
        return modelAndView;
    }


}
